package com.hgy.hhao.springboot_vue.mapper;

import com.hgy.hhao.springboot_vue.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user where id = #{id}")
    User getUserById(Integer id);

    @Select("insert into user (name,age,gender,phone) values (#{name},#{age},#{gender},#{phone})")
    void saveUser(User user);

    @Select("select * from user")
    List<User> getAll();

    @Select("select * from user where gender = #{gender}")
    List<User> getAllByGender(Integer gender);

    @Select("delete from user where id = #{id}")
    void deleteById(Integer id);
}
